#include "Movie.h"


Movie::Movie()
{
	title = " ";
	actors = " ";
	playing_time = 0;
	isOwner = false;
	hasSeenIt = false;
}

Movie::Movie(string t, string a, int p, bool i, bool h)
{
	title = t;
	actors = a;
	playing_time = p;
	isOwner = i;
	hasSeenIt = h;

}


void Movie::WriteMovie()
{
	cout << "Title: " << title << endl;
	cout << "Actors: " << actors << endl;
	cout << "Playing time: " << playing_time << endl;
	cout << "Own it: ";
	if (isOwner == 1)
		cout << "yes" << endl;
	else
		cout << "no" << endl;
	cout << "Have seen it: ";
	if (hasSeenIt == 1)
		cout << "yes" << endl << endl;
	else
		cout << "no" << endl << endl;
}

void Movie::ReadMovie()
{
	int isOwner1 = 0;
	int hasSeenIt1 = 0;

	cout << endl;
	cout << "Title = ";
	getline(cin, title);
	cout << endl;
	cout << "Actors = ";
	getline(cin, actors);
	cout << endl;
	cout << "Playing time (min) = ";
	cin >> playing_time;
	cout << endl;
	cout << "Owns it (1 for true)= ";
	cin >> isOwner1;
	if (isOwner1 == 1)
		isOwner = true;
	cout << endl;
	cout << "Have seen it (1 for true) = ";
	cin >> hasSeenIt1;
	if (hasSeenIt1 == 1)
		hasSeenIt = true;
	cout << endl;
	
}

ostream & operator << (ostream & out, const Movie & m)
{
	out << "Title: ";
	out << m.title << endl;
	out << "Actors: ";
	out << m.actors << endl;
	out << "Play time: ";
	out << m.playing_time << endl;
	out << "Owns it: ";
	out << m.isOwner << endl;
	out << "Have seen it: ";
	out << m.hasSeenIt << endl;


	return out;
}

istream & operator >> (istream & in, Movie & m)
{
	getline(in, m.title);
	getline(in, m.actors);
	in >> m.playing_time;
	in >> m.isOwner;
	in >> m.hasSeenIt;

	return in;
}



Movie::~Movie()
{
}
